package com.wanho.java159.cb.po;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.wanho.java159.base.po.BaseEntity;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
@Document(indexName = "index_car_info",type = "CarInfo")
public class CarInfo extends BaseEntity {
    @Field(type = FieldType.text, store = true)
    private String vin;
    @Field(type = FieldType.text, store = true, analyzer = "ik_smart")
    private String carNo;
    @Field(type = FieldType.text, store = true, analyzer = "ik_smart")
    private String carType;
    @Field(type = FieldType.text, store = true, analyzer = "ik_smart")
    private String carMaster;
    @Field(type = FieldType.text, store = true)
    private String carPic;
    @Field(type = FieldType.Integer, store = true)
    private Integer carMilage;
    @Field(type = FieldType.Date, store = true,pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date insuranceStartTime;
    @Field(type = FieldType.Date, store = true,pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date insuranceEndTime;
    @Field(type = FieldType.text, store = true, analyzer = "ik_smart")
    private String insuranceCompany;


    public String getVin() {
        return vin;
    }

    public void setVin(String vin) {
        this.vin = vin == null ? null : vin.trim();
    }

    public String getCarNo() {
        return carNo;
    }

    public void setCarNo(String carNo) {
        this.carNo = carNo == null ? null : carNo.trim();
    }

    public String getCarType() {
        return carType;
    }

    public void setCarType(String carType) {
        this.carType = carType == null ? null : carType.trim();
    }

    public String getCarMaster() {
        return carMaster;
    }

    public void setCarMaster(String carMaster) {
        this.carMaster = carMaster == null ? null : carMaster.trim();
    }

    public String getCarPic() {
        return carPic;
    }

    public void setCarPic(String carPic) {
        this.carPic = carPic == null ? null : carPic.trim();
    }

    public Integer getCarMilage() {
        return carMilage;
    }

    public void setCarMilage(Integer carMilage) {
        this.carMilage = carMilage;
    }

    public Date getInsuranceStartTime() {
        return insuranceStartTime;
    }

    public void setInsuranceStartTime(Date insuranceStartTime) {
        this.insuranceStartTime = insuranceStartTime;
    }

    public Date getInsuranceEndTime() {
        return insuranceEndTime;
    }

    public void setInsuranceEndTime(Date insuranceEndTime) {
        this.insuranceEndTime = insuranceEndTime;
    }

    public String getInsuranceCompany() {
        return insuranceCompany;
    }

    public void setInsuranceCompany(String insuranceCompany) {
        this.insuranceCompany = insuranceCompany == null ? null : insuranceCompany.trim();
    }

    @Override
    public String toString() {
        return "CarInfo{" +
                "vin='" + vin + '\'' +
                ", carNo='" + carNo + '\'' +
                ", carType='" + carType + '\'' +
                ", carMaster='" + carMaster + '\'' +
                ", carPic='" + carPic + '\'' +
                ", carMilage=" + carMilage +
                ", insuranceStartTime=" + insuranceStartTime +
                ", insuranceEndTime=" + insuranceEndTime +
                ", insuranceCompany='" + insuranceCompany + '\'' +
                "} " + super.toString();
    }
}
